package cn.tedu.egweibo5.base.config;

import cn.tedu.egweibo5.base.interceptors.LoginCheckInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: Miyako
 * @CreateTime: 2024-08-14  20:19
 * @Description: TODO
 */
@Slf4j
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginCheckInterceptor()).addPathPatterns("/v1/users/**")
                .excludePathPatterns("/v1/users/reg","/v1/users/login");
        registry.addInterceptor(new LoginCheckInterceptor()).addPathPatterns("/v1/weibo/insert");
        registry.addInterceptor(new LoginCheckInterceptor()).addPathPatterns("/v1/comment/insert");
    }
}
